function timeZoneDate(timestamp, timeZone) {

    var d = new Date(timestamp);
    var zone = timeZoneId(timeZone);
    if (zone === null)
        return d;
    var localTime = d.getTime(),
        localOffset = d.getTimezoneOffset() * 60000,
        utc = localTime + localOffset,
        localSecondTime = utc + (3600000 * zone);

    return new Date(localSecondTime);
}

function timeZoneId(timeZone) {

    if (timeZone === "" || timeZone === null || timeZone === undefined)
        return null;

    var TIME_ZONE =
        [
            {"Etc/GMT+12": -12},
            {"Etc/GMT+11": -11},
            {"Pacific/Pago_Pago": -11},
            {"Pacific/Niue": -11},
            {"Pacific/Midway": -11},
            {"Pacific/Honolulu": -10},
            {"Pacific/Rarotonga": -10},
            {"Pacific/Tahiti": -10},
            {"Pacific/Guam": -10},
            {"Pacific/Marquesas": 9.5},
            {"America/Adak": -9},
            {"Pacific/Gambier": -9},
            {"America/Santa_Isabel": -8},
            {"America/Metlakatla": -8},
            {"Pacific/Pitcairn": -8},
            {"America/Anchorage": -8},
            {"America/Sitka": -8},
            {"America/Yakutat": -8},
            {"America/Nome": -8},
            {"America/Juneau": -8},
            {"America/Hermosillo": -7},
            {"America/Phoenix": -7},
            {"America/Los_Angeles": -7},
            {"America/Creston": -7},
            {"America/Tijuana": -7},
            {"America/Dawson": -7},
            {"Asia/Ho_Chi_Minh": -7},
            {"America/Dawson_Creek": -7},
            {"America/Fort_Nelson": -7},
            {"America/Vancouver": -7},
            {"America/Whitehorse": -7},
            {"America/Guatemala": -6},
            {"America/Denver": -6},
            {"America/Regina": -6},
            {"America/Chihuahua": -6},
            {"America/Ojinaga": -6},
            {"America/Belize": -6},
            {"America/Cambridge_Bay": -6},
            {"America/Edmonton": -6},
            {"America/Inuvik": -6},
            {"America/Iqaluit": -6},
            {"America/Boise": -6},
            {"America/Moncton": -6},
            {"America/Swift_Current": -6},
            {"America/Yellowknife": -6},
            {"America/Costa_Rica": -6},
            {"America/El_Salvador": -6},
            {"America/Tegucigalpa": -6},
            {"America/Managua": -6},
            {"America/Mazatlan": -6},
            {"Pacific/Galapagos": -6},
            {"America/Bogota": -5},
            {"America/Chicago": -5},
            {"America/Indiana/Knox": -5},
            {"America/North_Dakota/Beulah": -5},
            {"America/North_Dakota/Center": -5},
            {"America/North_Dakota/New_Salem": -5},
            {"America/Eirunepe": -5},
            {"America/Matamoros": -5},
            {"America/Monterrey": -5},
            {"America/Mexico_City": -5},
            {"America/Rio_Branco": -5},
            {"America/Atikokan": -5},
            {"America/Menominee": -5},
            {"America/Indiana/Tell_City": -5},
            {"America/Rainy_River": -5},
            {"America/Rankin_Inlet": -5},
            {"America/Resolute": -5},
            {"America/Winnipeg": -5},
            {"America/Cayman": -5},
            {"America/Panama": -5},
            {"America/Lima": -5},
            {"America/Merida": -5},
            {"America/Guayaquil": -5},
            {"America/Bahia_Banderas": -5},
            {"America/Cancun": -5},
            {"Pacific/Easter": -5},
            {"America/Caracas": -4},
            {"America/Nipigon": -4},
            {"America/New_York": -4},
            {"America/Indiana/Marengo": -4},
            {"America/Indiana/Petersburg": -4},
            {"America/Indiana/Indianapolis": -4},
            {"America/Pangnirtung": -4},
            {"America/Asuncion": -4},
            {"America/La_Paz": -4},
            {"America/Cuiaba": -4},
            {"America/Kentucky/Louisville": -4},
            {"America/Kentucky/Monticello": -4},
            {"America/Havana": -4},
            {"America/Detroit": -4},
            {"America/Indiana/Vevay": -4},
            {"America/Indiana/Vincennes": -4},
            {"America/Indiana/Winamac": -4},
            {"America/Manaus": -4},
            {"America/Anguilla": -4},
            {"America/Antigua": -4},
            {"America/Nassau": -4},
            {"America/Barbados": -4},
            {"America/Kralendijk": -4},
            {"America/Boa_Vista": -4},
            {"America/Campo_Grande": -4},
            {"America/Porto_Velho": -4},
            {"America/Tortola": -4},
            {"America/Blanc-Sablon": -4},
            {"America/Thunder_Bay": -4},
            {"America/Toronto": -4},
            {"America/Curacao": -4},
            {"America/Dominica": -4},
            {"America/Santo_Domingo": -4},
            {"America/Grenada": -4},
            {"America/Guadeloupe": -4},
            {"America/Guyana": -4},
            {"America/Puerto_Rico": -4},
            {"America/Port-au-Prince": -4},
            {"America/Martinique": -4},
            {"America/Montserrat": -4},
            {"America/St_Vincent": -4},
            {"America/Lower_Princes": -4},
            {"America/St_Barthelemy": -4},
            {"America/St_Kitts": -4},
            {"America/Marigot": -4},
            {"America/St_Thomas": -4},
            {"America/Grand_Turk": -4},
            {"America/Port_of_Spain": -4},
            {"America/St_Lucia": -4},
            {"America/Sao_Paulo": -3},
            {"America/Cayenne": -3},
            {"America/Fortaleza": -3},
            {"America/Maceio": -3},
            {"America/Recife": -3},
            {"Atlantic/Bermuda": -3},
            {"Atlantic/Stanley": -3},
            {"America/Santarem": -3},
            {"America/Glace_Bay": -3},
            {"America/Goose_Bay": -3},
            {"America/Halifax": -3},
            {"America/Santiago": -3},
            {"America/Argentina/Buenos_Aires": -3},
            {"America/Argentina/Catamarca": -3},
            {"America/Argentina/Cordoba": -3},
            {"America/Argentina/Jujuy": -3},
            {"America/Argentina/La_Rioja": -3},
            {"America/Argentina/Mendoza": -3},
            {"America/Argentina/Rio_Gallegos": -3},
            {"America/Argentina/Salta": -3},
            {"America/Argentina/San_Juan": -3},
            {"America/Argentina/San_Luis": -3},
            {"America/Argentina/Tucuman": -3},
            {"America/Argentina/Ushuaia": -3},
            {"America/Montevideo": -3},
            {"America/Paramaribo": -3},
            {"Antarctica/Palmer": -3},
            {"Antarctica/Rothera": -3},
            {"America/Araguaina": -3},
            {"America/Bahia": -3},
            {"America/Belem": -3},
            {"America/Thule": -3},
            {"America/Punta_Arenas": -3},
            {"America/St_Johns": -2.5},
            {"America/Noronha": -2},
            {"America/Godthab": -2},
            {"Atlantic/South_Georgia": -2},
            {"America/Miquelon": -2},
            {"Etc/GMT+2": -2},
            {"Atlantic/Cape_Verde": -1},
            {"Atlantic/Azores": 0},
            {"Atlantic/Reykjavik": 0},
            {"Etc/GMT": 0},
            {"Africa/Banjul": 0},
            {"Africa/Accra": 0},
            {"Africa/Conakry": 0},
            {"Africa/Bissau": 0},
            {"Africa/Monrovia": 0},
            {"Africa/Ouagadougou": 0},
            {"Africa/Bamako": 0},
            {"Africa/Lome": 0},
            {"Africa/Freetown": 0},
            {"Africa/Nouakchott": 0},
            {"Atlantic/St_Helena": 0},
            {"America/Danmarkshavn": 0},
            {"Africa/Dakar": 0},
            {"America/Scoresbysund": 0},
            {"Africa/Abidjan": 0},
            {"Africa/Lagos": 1},
            {"Africa/Luanda": 1},
            {"Africa/Porto-Novo": 1},
            {"Africa/Kinshasa": 1},
            {"Africa/El_Aaiun": 1},
            {"Africa/Bangui": 1},
            {"Africa/Casablanca": 1},
            {"Africa/Ndjamena": 1},
            {"Africa/Niamey": 1},
            {"Atlantic/Madeira": 1},
            {"Atlantic/Canary": 1},
            {"Africa/Algiers": 1},
            {"Africa/Douala": 1},
            {"Africa/Malabo": 1},
            {"Africa/Sao_Tome": 1},
            {"Africa/Brazzaville": 1},
            {"Africa/Libreville": 1},
            {"Africa/Tunis": 1},
            {"Atlantic/Faroe": 1},
            {"Europe/Dublin": 1},
            {"Europe/Isle_of_Man": 1},
            {"Europe/Lisbon": 1},
            {"Europe/Guernsey": 1},
            {"Europe/London": 1},
            {"Europe/Jersey": 1},
            {"Europe/Berlin": 2},
            {"Europe/Gibraltar": 2},
            {"Europe/Busingen": 2},
            {"Europe/Madrid": 2},
            {"Europe/Paris": 2},
            {"Europe/Vienna": 2},
            {"Europe/Bratislava": 2},
            {"Europe/Ljubljana": 2},
            {"Europe/Andorra": 2},
            {"Europe/Brussels": 2},
            {"Europe/Sarajevo": 2},
            {"Europe/Zagreb": 2},
            {"Europe/Warsaw": 2},
            {"Europe/Belgrade": 2},
            {"Europe/Prague": 2},
            {"Europe/Malta": 2},
            {"Europe/Copenhagen": 2},
            {"Europe/Budapest": 2},
            {"Europe/Rome": 2},
            {"Europe/Podgorica": 2},
            {"Europe/Oslo": 2},
            {"Europe/Amsterdam": 2},
            {"Europe/Monaco": 2},
            {"Europe/Stockholm": 2},
            {"Europe/Vaduz": 2},
            {"Europe/Luxembourg": 2},
            {"Europe/Zurich": 2},
            {"Europe/San_Marino": 2},
            {"Europe/Skopje": 2},
            {"Europe/Kaliningrad": 2},
            {"Europe/Vatican": 2},
            {"Africa/Cairo": 2},
            {"Africa/Maputo": 2},
            {"Africa/Windhoek": 2},
            {"Arctic/Longyearbyen": 2},
            {"Africa/Mbabane": 2},
            {"Africa/Khartoum": 2},
            {"Africa/Gaborone": 2},
            {"Africa/Bujumbura": 2},
            {"Africa/Ceuta": 2},
            {"Africa/Lubumbashi": 2},
            {"Africa/Lusaka": 2},
            {"Africa/Harare": 2},
            {"Africa/Johannesburg": 2},
            {"Africa/Maseru": 2},
            {"Africa/Tripoli": 2},
            {"Africa/Blantyre": 2},
            {"Africa/Kigali": 2},
            {"Antarctica/Troll": 2},
            {"Africa/Djibouti": 3},
            {"Asia/Jerusalem": 3},
            {"Asia/Baghdad": 3},
            {"Asia/Gaza": 3},
            {"Asia/Aden": 3},
            {"Asia/Hebron": 3},
            {"Europe/Minsk": 3},
            {"Europe/Athens": 3},
            {"Europe/Tirane": 3},
            {"Europe/Mariehamn": 3},
            {"Europe/Vilnius": 3},
            {"Europe/Sofia": 3},
            {"Europe/Kirov": 3},
            {"Europe/Chisinau": 3},
            {"Europe/Tallinn": 3},
            {"Europe/Istanbul": 3},
            {"Europe/Kiev": 3},
            {"Europe/Uzhgorod": 3},
            {"Europe/Zaporozhye": 3},
            {"Europe/Helsinki": 3},
            {"Europe/Riga": 3},
            {"Europe/Bucharest": 3},
            {"Europe/Simferopol": 3},
            {"Europe/Volgograd": 3},
            {"Europe/Moscow": 3},
            {"Asia/Damascus": 3},
            {"Africa/Nairobi": 3},
            {"Africa/Asmara": 3},
            {"Africa/Kampala": 3},
            {"Africa/Addis_Ababa": 3},
            {"Africa/Juba": 3},
            {"Africa/Mogadishu": 3},
            {"Africa/Dar_es_Salaam": 3},
            {"Asia/Riyadh": 3},
            {"Asia/Amman": 3},
            {"Asia/Qatar": 3},
            {"Asia/Kuwait": 3},
            {"Asia/Bahrain": 3},
            {"Asia/Famagusta": 3},
            {"Asia/Nicosia": 3},
            {"Asia/Beirut": 3},
            {"Antarctica/Syowa": 3},
            {"Indian/Comoro": 3},
            {"Indian/Mayotte": 3},
            {"Indian/Antananarivo": 3},
            {"Asia/Tehran": 3.5},
            {"America/Aruba": 4},
            {"Asia/Tbilisi": 4},
            {"Asia/Yerevan": 4},
            {"Asia/Dubai": 4},
            {"Asia/Muscat": 4},
            {"Asia/Baku": 4},
            {"Europe/Astrakhan": 4},
            {"Europe/Ulyanovsk": 4},
            {"Europe/Saratov": 4},
            {"Europe/Samara": 4},
            {"Indian/Mauritius": 4},
            {"Indian/Mahe": 4},
            {"Indian/Reunion": 4},
            {"Asia/Kabul": 4.5},
            {"Asia/Tashkent": 5},
            {"Asia/Karachi": 5},
            {"Asia/Aqtau": 5},
            {"Asia/Aqtobe": 5},
            {"Asia/Atyrau": 5},
            {"Asia/Samarkand": 5},
            {"Asia/Dushanbe": 5},
            {"Asia/Ashgabat": 5},
            {"Asia/Oral": 5},
            {"Asia/Yekaterinburg": 5},
            {"Antarctica/Mawson": 5},
            {"America/Jamaica": 5},
            {"Indian/Kerguelen": 5},
            {"Indian/Maldives": 5},
            {"Asia/Colombo": 5.5},
            {"Asia/Kolkata": 5.5},
            {"Asia/Kathmandu": 5.75},
            {"Asia/Almaty": 6},
            {"Asia/Bishkek": 6},
            {"Asia/Omsk": 6},
            {"Asia/Qyzylorda": 6},
            {"Asia/Thimphu": 6},
            {"Asia/Dhaka": 6},
            {"Asia/Urumqi": 6},
            {"Antarctica/Vostok": 6},
            {"Indian/Chagos": 6},
            {"Indian/Cocos": 6.5},
            {"Asia/Rangoon": 6.5},
            {"Asia/Yangon": 6.5},
            {"Asia/Bangkok": 7},
            {"Asia/Vientiane": 7},
            {"Asia/Novosibirsk": 7},
            {"Asia/Phnom_Penh": 7},
            {"Asia/Jakarta": 7},
            {"Asia/Hovd": 7},
            {"Asia/Novokuznetsk": 7},
            {"Asia/Barnaul": 7},
            {"Asia/Tomsk": 7},
            {"Asia/Pontianak": 7},
            {"Antarctica/Davis": 7},
            {"Indian/Christmas": 7},
            {"Asia/Krasnoyarsk": 7},
            {"Asia/Ulaanbaatar": 8},
            {"Asia/Shanghai": 8},
            {"Asia/Hong_Kong": 8},
            {"Asia/Kuala_Lumpur": 8},
            {"Asia/Kuching": 8},
            {"Asia/Manila": 8},
            {"Asia/Choibalsan": 8},
            {"Australia/Perth": 8},
            {"Antarctica/Casey": 8},
            {"Asia/Singapore": 8},
            {"Asia/Taipei": 8},
            {"Asia/Irkutsk": 8},
            {"Asia/Brunei": 8},
            {"Asia/Macau": 8},
            {"Asia/Makassar": 8},
            {"Australia/Eucla": 8.75},
            {"Asia/Khandyga": 9},
            {"Asia/Seoul": 9},
            {"Asia/Tokyo": 9},
            {"Asia/Dili": 9},
            {"Asia/Chita": 9},
            {"Asia/Jayapura": 9},
            {"Asia/Yakutsk": 9},
            {"Asia/Pyongyang": 9},
            {"Pacific/Palau": 9},
            {"Australia/Darwin": 9.5},
            {"Australia/Adelaide": 9.5},
            {"Australia/Broken_Hill": 9.5},
            {"Antarctica/DumontDUrville": 10},
            {"Australia/Hobart": 10},
            {"Australia/Currie": 10},
            {"Australia/Sydney": 10},
            {"Australia/Brisbane": 10},
            {"Australia/Melbourne": 10},
            {"Asia/Ust-Nera": 10},
            {"Asia/Vladivostok": 10},
            {"Australia/Lindeman": 10},
            {"Pacific/Port_Moresby": 10},
            {"Pacific/Saipan": 10},
            {"Pacific/Chuuk": 10},
            {"Australia/Lord_Howe": 10.5},
            {"Asia/Magadan": 11},
            {"Asia/Sakhalin": 11},
            {"Asia/Srednekolymsk": 11},
            {"Pacific/Guadalcanal": 11},
            {"Pacific/Kosrae": 11},
            {"Pacific/Pohnpei": 11},
            {"Pacific/Noumea": 11},
            {"Pacific/Efate": 11},
            {"Pacific/Bougainville": 11},
            {"Pacific/Norfolk": 11},
            {"Antarctica/Macquarie": 11},
            {"Etc/GMT-12": 12},
            {"Pacific/Fiji": 12},
            {"Pacific/Funafuti": 12},
            {"Asia/Anadyr": 12},
            {"Asia/Kamchatka": 12},
            {"Pacific/Auckland": 12},
            {"Pacific/Tarawa": 12},
            {"Pacific/Kwajalein": 12},
            {"Pacific/Majuro": 12},
            {"Pacific/Nauru": 12},
            {"Pacific/Wake": 12},
            {"Pacific/Wallis": 12},
            {"Antarctica/McMurdo": 12},
            {"Pacific/Chatham": 12.75},
            {"Pacific/Tongatapu": 13},
            {"Pacific/Apia": 13},
            {"Pacific/Fakaofo": 13},
            {"Pacific/Enderbury": 13},
            {"Pacific/Kiritimati": 14}
        ];

    for (var i = 0, l = TIME_ZONE.length; i < l; i++) {
        for (var key in TIME_ZONE[i]) {
            if (key === timeZone) {
                return TIME_ZONE[i][timeZone]
            }
        }

    }
    return null;
}


